
import java.util.Scanner;

public class ProgressBar {
    public static void main(String[] args) throws InterruptedException {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入今天已投入的小时数: ");
        int currenttoday = scanner.nextInt();
        int current = 0 + currenttoday;
        int totalHours = 390;  // 200已投入 + 13*30=390新增

        System.out.println("编程能力升级进度:");
        while (current <= totalHours) {
            int progress = (int) ((double) current / totalHours * 100);
            String bar = buildProgressBar(progress);

            // 使用回车符覆盖当前行

            System.out.printf("\r[%s] %d%% 已学习 %d/%d小时", bar, progress, current, totalHours);

            Thread.sleep(360000000);  // 模拟1小时学习(实际按13小时/天压缩)
            current++;
        }
        System.out.println("\n✅ 累计完成590小时!");
        scanner.close();
    }

    private static String buildProgressBar(int progress) {
        StringBuilder sb = new StringBuilder();
        int blocks = progress / 2;
        sb.append("=".repeat(Math.max(0, blocks)));
        if (progress < 100) sb.append(">");
        sb.append(" ".repeat(Math.max(0, 50 - blocks)));
        return sb.toString();
    }
}